# 案例3：【带json数据的post请求】 验证码： 地址：http://kdtx-test.itheima.net/api/captchaImage
# 方法：get
# 登录： 地址：http://kdtx-test.itheima.net/api/login
# 方法：Post 请求数据：
# 请求头：Content-Type: application/json
# 请求体：{"username": "admin", "password": "admin123","code":"2", "uuid":"验证码接口返回数据"}
# 导包
import  requests
resp_v=requests.get ("http://kdtx-test.itheima.net/api/captchaImage")
uuid=resp_v.json()["uuid"]
resp_l=requests.post("http://kdtx-test.itheima.net/api/login",
                     headers={"Content-Type": "application/json"},
                     json={"username": "admin", "password": "HM_2023_test",
                              "code":"2", "uuid":uuid})

print (resp_l.json ())

